//
//  Storage.h
//  OMENGO
//
//  Created by 梁尚嘉 on 2016/12/6.
//  Copyright © 2016年 Kamfat. All rights reserved.
//

#import "BaseModel.h"
#import "OMAccount.h"
#import <UIKit/UIKit.h>
#import "OMOriginalAddress.h"
#define KTSystemStorageSingleton [Storage shareInstance]
extern NSString * const KTLoginSuccessNotificationKey;
extern NSString * const KTOrginalAddressNotificationKey;

@class UIImage;
@interface Storage : BaseModel

@property (nonatomic, strong) OMAccount *account;
@property (copy, nonatomic) NSString    *username;
@property (copy, nonatomic) NSString    *userPassword;
@property (assign, nonatomic) NSUInteger numOfCartItem;
@property (nonatomic, strong) UIButton *cartButton;
@property (nonatomic, strong) UIButton *badgeView;
@property (nonatomic, strong) OMOriginalAddress *originalAddress;

@property (nonatomic, copy) NSString *cartKey;

/**  是否已经登录  */
+ (BOOL)isLogin;
+ (void)setLogin:(BOOL)isLogin;

+ (instancetype)shareInstance;


/**  save Token  */
+ (void)saveAuthorizationToken:(NSString *)token;


/** get Token **/
+ (NSString *)authorizationToken;

//清理图片内存缓存（YYKIT）
+ (void)removeImageMemoryCache;
//清理图片磁盘缓存（YYKIT）
+ (void)removeImageDiskCache;

//缓存购物车的选择项
+ (void)saveCartSectionSelection:(NSDictionary *)sectionSelection andCartSelection:(NSDictionary *)selection;
+ (NSDictionary *)cartSectionSelection;
+ (NSDictionary *)cartSelection;

//缓存GET请求
+ (void)saveCacheGetMethodDataWithUrl:(NSString *)url withData:(id)data;
//获取GET请求缓存
+ (id)getCacheByGetMethodWithUrl:(NSString *)url;
//清除GET请求缓存
+ (BOOL)removeGetMethodCache;


//====================缓存图片=====================
+ (void)saveImageInCache:(UIImage *)image onCompletion:(void (^)(BOOL isSuccess,NSString *uuid))completion;
//删除图片缓存
+ (void)removeImageInCacheWithName:(NSString *)name;

+ (UIImage *)imageInCacheWithName:(NSString *)name;

//图片url
+ (id)imageURLInCacheWithName:(NSString *)name;
//====================缓存图片=====================END

@end
